using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using MULENetworking;

namespace SimpleTestClient
{
    static class SimpleClient
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            MessageBox.Show("About to connect to server.\nYour mom means I work.");
            TcpChannel chan = new TcpChannel();
            ChannelServices.RegisterChannel(chan, false);

            IChatRoom remoteChat = (IChatRoom)Activator.GetObject(typeof(IChatRoom), "tcp://localhost:9985/ChatterBox");
            if (remoteChat == null)
                MessageBox.Show("cannot connect to remoting server");
            else
            {
                MessageBox.Show(remoteChat.lastMessage);
                remoteChat.lastMessage = "Your mom!";
                MessageBox.Show(remoteChat.lastMessage);
            }
            
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());
        }
    }
}